/*
 * Copyright 2011 Mark Davidson.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

package org.dctmcommons;

import java.util.Map;

import com.documentum.fc.client.IDfTypedObject;
import com.documentum.fc.common.DfException;

/**
 * Attribute-related helper methods.
 */
public interface IAttribHelper {

	/**
	 * Merges a string template with attribute values.
	 * @param object The typed object
	 * @param template The string template
	 * @return The merged string
	 * @throws DfException The repository exception
	 */
	public String interpolate(IDfTypedObject object,
							  String template)
			throws DfException;

	/**
	 * Reads attribute values from a typed object into a Map. Repeating values
	 * are converted to arrays.
	 * @param typedObject The typed object
	 * @param attribNames The list of names of attributes to read. Passing a
	 * null will cause all attributes to be read.
	 * @return The map of attribute values
	 * @throws DfException The repository exception
	 */
	public Map<String, Object> readAttribs(IDfTypedObject typedObject,
										   String[] attribNames)
		throws DfException;

	/**
	 * Gets a list of attribute names for the specified typed object.
	 * @param typedObject The typed object
	 * @return The list of attribute names
	 * @throws DfException The repository exception
	 */
	public String[] getAttribNames(IDfTypedObject typedObject)
			throws DfException;

}